package com.tedu.day07springmvc.controller;

import com.tedu.day07springmvc.pojo.dto.BmiDTO;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BmiContorller {
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(BmiDTO bmiDTO){
        double h = bmiDTO.getHeight();
        double w = bmiDTO.getWeight();
        double bmi=w/(h*h);
        String  state=bmi<18.5?"偏瘦"
                     :bmi<24?"正常"
                     :bmi<27?"微胖":"该减肥了";
        return state;
    }
}
